<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>账号管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1 ,minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="static/ydui/ydui.rem.css">
    <link rel="stylesheet" href="static/css/font-awesome.min.css">
    <link rel="stylesheet" href="static/css/main.css">
    <!-- 引入rem自适应类库 -->
    <script src="static/ydui/ydui.flexible.js"></script>
</head>
<body>
<div id="app" v-cloak style="height:100%;background-color: #fff;">
    <yd-layout>
    	
    	<yd-navbar slot="navbar" title="账号管理">
            <a href="center.html" slot="left">
                <yd-navbar-back-icon>返回</yd-navbar-back-icon>
            </a>
        </yd-navbar>

        <yd-cell-group>
            <yd-cell-item arrow type="a" :href="'change-mobile.html?phone='+phone">
                <span slot="left" style="font-weight: 600;">更换手机</span>
            </yd-cell-item>
            <yd-cell-item arrow type="a" :href="'login-password.html?phone='+phone">
                <span slot="left" style="font-weight: 600;">修改登录密码</span>
            </yd-cell-item>
            <yd-cell-item arrow type="a" :href="'pay-password.html?phone='+phone">
                <span slot="left" style="font-weight: 600;">设置资金密码</span>
            </yd-cell-item>
        </yd-cell-group>

        <div class="yd-button">
            <yd-button size="large" type="hollow" style="border-radius: 0.5rem;" @click.native="logout">退出登录</yd-button>
        </div>

    </yd-layout>
</div>
<!-- 引入 Vue -->
<script src="static/lib/vue.min.js"></script>
<script src="static/lib/jquery.min.js"></script>
<script src="static/lib/fastclick.js"></script>
<script>
    $(function() {
        FastClick.attach(document.body);
    });
</script>
<!-- 引入组件库 -->
<script src="static/ydui/ydui.rem.js"></script>
<script src="static/js/common.js"></script>
<script>
    var vm = new Vue({
        el: '#app',
        data: {
            phone:''
        },
        created:function () {
            this.phone = this.getUrlParam('phone');
        },
        methods:{
            getUrlParam:function (name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
                var r = window.location.search.substr(1).match(reg);  //匹配目标参数
                if (r != null) return unescape(r[2]); return null; //返回参数值
            },
            logout:function () {
                localStorage.removeItem("token");
                location.href = 'login.html';

//                var pt = this;
//                pt.$dialog.loading.open('注销中...');
//
//
//                $.ajax({
//                    type: "POST",
//                    url: baseURL + "/rest-auth/logout/",
//                    data: '',
//                    contentType: "application/json",
//                    dataType:  "json",
//                    success: function(r){
//                        pt.$dialog.loading.close();
//                        pt.$dialog.toast({
//                            mes: '注销成功',
//                            icon: 'success',
//                            timeout: 1500,
//                            callback:function () {
//                                //删除本地token
//                                localStorage.removeItem("token");
//                                location.href = 'login.html';
//                            }
//                        });
//                    },
//                    error:function(e){
//                        pt.$dialog.loading.close();
//                        if(typeof e.responseText != 'undefined'){
//                            pt.$dialog.toast({
//                                mes: e.responseText,
//                                icon: 'error',
//                                timeout: 1500
//                            });
//                        }else {
//                            pt.$dialog.toast({
//                                mes: '注销异常',
//                                icon: 'error',
//                                timeout: 1500
//                            });
//                        }
//                    }
//                });
            }
        }
    });
</script>
</body>
</html>